package command;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import exceptions.WrongShareName;
import interfaces.Executable;

public class Command extends CommandDescriptor implements Executable {

	@Override
	public Object execute() throws Throwable {

		Method method = commandType.getFunction();
		Object target = commandType.getTarget();
		Object result;
		try {
			result = method.invoke(target, this.getParams());
		} catch (InvocationTargetException e) {
			throw e.getCause();
		}
		return result;
	}

}
